home *** CD-ROM | disk | FTP | other *** search
/ Shareware Games Galore! / Shareware Games Galore!.iso / arcade / gameser5 / awari.bas (.txt) < prev    next >
Encoding:
GW-BASIC  |  1980-01-01  |  4.0 KB  |  134 lines

  1. 1  '**********************************
  2. 2  ' Adapted from the Microcomputer
  3. 3  '     Edition of the book
  4. 4  '    BASIC COMPUTER GAMES
  5. 5  '   Edited by David H. Ahl
  6. 6  '**********************************
  7. 7  '
  8. 10  CLS:KEY OFF
  9. 20  PRINT :PRINT TAB(18) "AWARI"
  10. 22  PRINT :PRINT
  11. 24  PRINT "Awari is an ancient African game played"
  12. 25  PRINT "with seven sticks and thirty-six stones"
  13. 26  PRINT "or beans. The board is divided into six"
  14. 27  PRINT "compartments or pits on each side. In"
  15. 28  PRINT "addition, there are two special home "
  16. 30  PRINT "pits at the ends.":PRINT
  17. 32  PRINT "A move is made by taking all of the "
  18. 34  PRINT "beans from any (non-empty) pit on your"
  19. 36  PRINT "own side (bottom) and, starting from"
  20. 38  PRINT "the pit to the right of this one, place one bean in each pit working around"
  21. 40  PRINT "the board anticlockwise.":PRINT
  22. 42  PRINT "A turn consists of one or two moves."
  23. 44  PRINT "If the last bean of your move is sown"
  24. 46  PRINT "in your own home you may take a second  move.":PRINT
  25. 50  PRINT :PRINT "      MORE, press enter key.";
  26. 51  A$=INKEY$:IF A$="" THEN 51
  27. 52  CLS
  28. 55  PRINT :PRINT TAB(18) "AWARI"
  29. 56  PRINT :PRINT
  30. 60  PRINT "If the last bean sown in a move lands"
  31. 62  PRINT "in an empty pit, provided that the "
  32. 64  PRINT "opposite pit is not empty,all the beans"
  33. 66  PRINT "in the opposite pit, together with the"
  34. 68  PRINT "last bean sown are captured and moved"
  35. 70  PRINT "to that player's home.":PRINT
  36. 74  PRINT "When either side is empty, the game is"
  37. 76  PRINT "finished. The player with the most "
  38. 77  PRINT "beans in his home has won.":PRINT
  39. 78  PRINT "To make a move, type in the pit's "
  40. 80  PRINT "number. If the last bean lands in your"
  41. 82  PRINT "home,the computer responds with"
  42. 84  PRINT "`Move again' and you then type in your"
  43. 86  PRINT "second move.":PRINT
  44. 90  PRINT "The computer always gives you the first"
  45. 92  PRINT "move."
  46. 129  PRINT :PRINT "Press any key to begin game.";
  47. 130  A$=INKEY$:IF A$="" THEN 130
  48. 135  DATA 0
  49. 140  DIM B(13),G(13),F(50):READ N
  50. 150  E=0
  51. 160  FOR I=0 TO 12:B(I)=3:NEXT I
  52. 165  C=0:F(N)=0:B(13)=0:B(6)=0
  53. 172  CLS
  54. 175  PRINT :PRINT TAB(18) "AWARI"
  55. 177  LOCATE 23,10:PRINT "** SCORE  BOARD **"
  56. 178  PRINT TAB(8) "MY SIDE ";MS" YOUR SIDE ";YS;
  57. 179  LOCATE 25,13:PRINT "TIE GAMES ";TG;
  58. 180  GOSUB 510
  59. 182  FOR T=1 TO 1000: NEXT T
  60. 185  LOCATE 15,1 :PRINT "                    "
  61. 190  LOCATE 15,1:PRINT "Your move ";:GOSUB 360
  62. 200  IF E=0 THEN 270
  63. 210  IF M=H THEN GOSUB 350
  64. 220  IF E=0 THEN 270
  65. 225  LOCATE 15,1:PRINT "                    "
  66. 230  LOCATE 15,1:PRINT "My move is ";:GOSUB 670
  67. 240  IF E=0 THEN 270
  68. 250  IF M=H THEN PRINT ",";:GOSUB 670
  69. 260  IF E>0 THEN 180
  70. 270  LOCATE 17,1:PRINT "End of game."
  71. 280  D=B(6)-B(13):IF D<0 THEN MS=MS+1:PRINT "I win by";-D;"points.":GOTO 310
  72. 290  N=N+1:IF D=0 THEN PRINT "Tie game.": TG=TG+1:GOTO 310
  73. 300  PRINT "You win by";D;"points.":YS=YS+1
  74. 310  PRINT :PRINT "Play again (y/n): ";
  75. 320  KB$=INKEY$:IF KB$="" THEN 320
  76. 330  IF LEFT$(KB$,1)="n" OR LEFT$(KB$,1)="N" THEN LOAD"masterp",R
  77. 344  GOTO 150
  78. 350  LOCATE 15,1:PRINT "Move again.";
  79. 360  INPUT " ",M:IF M<7 AND M>0 THEN M=M-1:GOTO 380
  80. 370  BEEP:PRINT "Illegal move!!!":FOR TD=1 TO 1000:NEXT TD:LOCATE 16,1:PRINT "                    ":GOTO 350
  81. 380  IF B(M)=0 THEN 370
  82. 390  H=6: GOSUB 410
  83. 400  GOTO 510
  84. 410  K=M: GOSUB 610
  85. 420  E=0: IF K>6 THEN K=K-7
  86. 430  C=C+1: IF C<9 THEN F(N)=F(N)*6+K
  87. 440  FOR I=0 TO 5
  88. 450  IF B(I) <> 0 THEN 460 ELSE 490
  89. 460    FOR KB=7 TO 12
  90. 470    IF B(KB)<>0 THEN E=1
  91. 480    NEXT KB
  92. 490  NEXT I
  93. 500  RETURN
  94. 510  LOCATE 7,11:PRINT "MY SIDE"
  95. 512  LOCATE 8,1:COLOR 0,7 :PRINT "HOME 6   5   4   3   2   1":COLOR 7,0:PRINT "   ";
  96. 520  FOR I=12 TO 7 STEP -1: GOSUB 590
  97. 530  NEXT I
  98. 540  PRINT :I=13:GOSUB 590
  99. 550  PRINT "                       ";:PRINT B(6):PRINT "   ";
  100. 560  FOR I=0 TO 5: GOSUB 590
  101. 570  NEXT I
  102. 575  PRINT :PRINT "     ";:COLOR 0,7:PRINT "1   2   3   4   5   6 HOME":COLOR 7,0
  103. 577  PRINT "            YOUR SIDE"
  104. 580  PRINT :PRINT :RETURN
  105. 590  IF B(I)<10 THEN COLOR 7:PRINT " ";
  106. 600  PRINT B(I);:RETURN
  107. 610  P=B(M):B(M)=0
  108. 620  FOR P=P TO 1 STEP -1:M=M+1:IF M>13 THEN M=M-14
  109. 630  B(M)=B(M)+1:NEXT P
  110. 640  IF B(M)=1 THEN IF M<>6 THEN IF M<>13 THEN IF B(12-M)<>0 THEN 660
  111. 650  RETURN
  112. 660  B(H)=B(H)+B(12-M)+1:B(M)=0:B(12-M)=0:RETURN
  113. 670  D=-99:H=13
  114. 680  FOR I=0 TO 13:G(I)=B(I):NEXT I
  115. 690  FOR J=7 TO 12: IF B(J)=0 THEN 830
  116. 700  G=0:M=J::GOSUB 610
  117. 710  FOR I=0 TO 5: IF B(I)=0 THEN 760
  118. 720  L=B(I)+I:R=0
  119. 730  IF L>13 THEN L=L-14:R=1:GOTO 730
  120. 740  IF B(L)=0 AND L<>6 AND L<>13 THEN R=B(12-L)+R
  121. 750  IF R>Q THEN Q=R
  122. 760  NEXT I
  123. 770  Q=B(13)-B(6)-Q: IF C>8 THEN 810
  124. 780  K=J: IF K>6 THEN K=K-7
  125. 790  FOR I=0 TO N-1: IF F(N)*6+K=INT(F(I)/6^(7-C)+0.1) THEN Q=Q-2
  126. 800  NEXT I
  127. 810  FOR I=0 TO 13:B(I)=G(I):NEXT I
  128. 820  IF Q>=D THEN A=J:D=Q
  129. 830  NEXT J
  130. 840  M=A:PRINT CHR$(42+M);:GOTO 410
  131. 850  FOR I=0 TO N-1: PRINT B(I):NEXT I
  132. 860  END
  133. 870  IF B(M) =1 AND M<>6 AND M<>13 AND B(12-M)<>0 THEN 660
  134.